import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    user: JSON.parse(localStorage.getItem('user')) || "" 
  },
  mutations: {
    setUser(state,newUser){
      state.user = newUser;
    },
    exit(state){
      state.user = "",
      window.localStorage.setItem('user',"");
    }
  },
  actions: {
  },
  modules: {
  }
})
